!lm11
!rm76
Patch S-C Assembler II for More Errors

Some of you have asked for a way to see all your errors at once.  If you patch Version 4.0 in this simple way, you will see all error messages during one ASM, instead of aborting the assembly after the first error.

Look at $1752 to $1754; you should see 20 81 1A.  If you do, then make this patch:

     :$1752:4C 8E 18

Now try an assembly of some source code with several errors in it.  You will see all the errors on your screen.  Or if your printer is on, they will all print.

Personally, I liked it better the other way.  But if you never make more than one error per program, you won't be able to tell the difference!


Fast String Input Routine for Applesoft

Yet another use for the imperious ampersand!  This program will read a line from the keyboard or a text file into a string variable.  It will accept commas and colons without complaint, too.  No more "EXTRA IGNORED" messages, and much less chance of garbage collection tying things up.

The program is shown here with the origin set to $0300, the most popular place in your Apple.  If that taxi is already full, you can change the origin to whatever you like.  In fact, the subroutine itself is completely relocatable.  You can put it anywhere in memory you like, just so you set $3F6 and 3F7 to point to it.

Lines 1160-1220 are executed if you BRUN a file with this program on it.  They put a JMP GET into $3F5, so that the "&" will call my subroutine.  Once this code is executed, you can execute statements like "&GET A$" to read a line into a string.

Lines 1240-1500 are the input subroutine.  At line 1240 the token following the ampersand is tested; it should be $BE, which is the token for "GET".  If not, JMP $DEC9 makes your screen say "SYNTAX ERROR"!

Lines 1270 and 1280 set up the address of the string variable in locations $83 and $84.  We will use this later to tell Applesoft where the input line is.

Lines 1290-1360 change the prompt symbol to a bell (in case you backspace too much) and call on the monitor input routine to read a line.  After the line is read, the prompt is restored to whatever it was before.  The length of the input line is in the X-register, and the line itself is in the buffer starting at $0200.

Lines 1370 and 1380 call on Applesoft to set aside space for the input line in the string area.  This may force garbage collection if you are about out of memory at the time.  GETSPA leaves the address of the start of the slot set aside for our input line in locations $71 and $72.

Lines 1390-1460 store the length and address of the input line into the string variable.  The address is of the slot GETSPA just reserved.

Lines 1470-1500 call on MOVSTR to copy the input line from the monitor's input buffer (at $0200) into the slot reserved by GETSPA.

Now if you want to read some data off the disk which might have commas and colons in it, you can do it like this:

!lm16
100 PRINT CHR$(4) "OPEN MY.FILE"
110 PRINT CHR$(4) "READ MY.FILE"
120 FOR I = 1 TO 10
130 & GET A$(I)
140 NEXT I
!lm11


Applesoft Internal Entry Points

An excellent article appeared just over a year ago (by the same title) in The Apple Orchard, Volume 1, Number 1, March/April 1980.  John Crossley of Apple Computer, Inc. wrote it.  He revealed most of the usable entry points within the Applesoft ROM, and many details on how they work and how to use them.  If you don't have that magazine, go get one right away.  They are available at some stores, through some local Apple clubs, and directly from the publisher (the Internatioal Apple Corps).  There are a few typographical errors, but you should be able to figure them out by comparing with a disassembly.

To get you started, I have made up a list of my own which includes the starting addresses for all the keyword routines.
 I got these from the ROM itself.  The keyword list starts at $D0D0, and a parallel list of addresses starts at $D000.  The addresses in the list are all low-byte-first, and are all pointing to one byte before the actual start.  That is because Applesoft branches to the appropriate routine by placing the address from this list on the stack and then using RTS (see AAL issue #1, page 11, for an explanation of this technique).

This chart shows all the token values for Applesoft, and the address where the token is processed.

 token   keyword  addr

80  128  END      D870
81  129  FOR      D766
82  130  NEXT     DCF9
83  131  DATA     D995
84  132  INPUT    DBB2
85  133  DEL      F331
86  134  DIM      DFD9
87  135  READ     DBE2
88  136  GR       F390
89  137  TEXT     F399
8A  138  PR#      F1E5
8B  139  IN#      F1DE
8C  140  CALL     F1D5
8D  141  PLOT     F225
8E  142  HLIN     F232
8F  143  VLIN     F241
90  144  HGR2     F3D8
91  145  HGR      F3E2
92  146  HCOLOR=  F6E9
93  147  HPLOT    F6FD
94  148  DRAW     F769
95  149  XDRAW    F76F
96  150  HTAB     F7E7
97  151  HOME     FC58
98  152  ROT=     F721
99  153  SCALE=   F727
9A  154  SHLOAD   F775
9B  155  TRACE    F26D
9C  156  NOTRACE  F26F
9D  157  NORMAL   F273
9E  158  INVERSE  F277
9F  159  FLASH    F280
A0  160  COLOR=   F24F
A1  161  POP      D96B
A2  162  VTAB     F256
A3  163  HIMEM:   F286
A4  164  LOMEM:   F2A6
A5  165  ONERR    F2CB
A6  166  RESUME   F318
A7  167  RECALL   F3BC
A8  168  STORE    F39F
A9  169  SPEED=   F262
AA  170  LET      DA46
AB  171  GOTO     D93E
AC  172  RUN      D912
AD  173  IF       D9C9
AE  174  RESTORE  D849
AF  175  &        03F5
B0  176  GOSUB    D921
B1  177  RETURN   D96B
B2  178  REM      D9DC
B3  179  STOP     D86E
B4  180  ON       D9EC
B5  181  WAIT     E784
!np
 token   keyword  addr

B6  182  LOAD     D8C9
B7  183  SAVE     D8B0
B8  184  DEF      E313
B9  185  POKE     E77B
BA  186  PRINT    DAD5
BB  187  CONT     D896
BC  188  LIST     D6A5
BD  189  CLEAR    D66A
BE  190  GET      DBA0
BF  191  NEW      D649
C0  192  TAB(
C1  193  TO
C2  194  FN
C3  195  SPC(
C4  196  THEN
C5  197  AT
C6  198  NOT
C7  199  STEP
C8  200  +
C9  201  -
CA  202  *
CB  203  /
CC  204  ^
CD  205  AND
CE  206  OR
CF  207  >
D0  208  =
D1  209  <
D2  210  SGN      EB91
D3  211  INT      EC24
D4  212  ABS      EBB0
D5  213  USR      000A
D6  214  FRE      E2DF
D7  215  SCRN(    D413
D8  216  PDL      DFCE
D9  217  POS      E300
DA  218  SQR      EE8E
DB  219  RND      EFAF
DC  220  LOG      E942
DD  221  EXP      EF0A
DE  222  COS      EFEB
DF  223  SIN      EFF2
E0  224  TAN      F03B
E1  225  ATN      F09F
E2  226  PEEK     E765
E3  227  LEN      E6D7
E4  228  STR$     E3C6
E5  229  VAL      E708
E6  230  ASC      E6E6
E7  231  CHR$     E647
E8  232  LEFT$    E65B
E9  233  RIGHT$   E687
EA  234  MID$     E691
